import { handleLocalStorage } from "@/utils";
let deviceId = handleLocalStorage.get("deviceId");
import { defineStore } from "pinia";

export const useCommonStore = defineStore("commonStore", {
  state: () => {
    return {
      deviceId: deviceId || "",
    };
  },
  getters: {},
  actions: {
    setDeviceInfo: (deviceInfo) => {
      handleLocalStorage.set("deviceId", deviceInfo);
      this.deviceId = deviceInfo;
    },
    clearDeviceInfo: () => {
      handleLocalStorage.remove("deviceId");
      this.deviceId = "";
    },
  },
});
